home *** CD-ROM | disk | FTP | other *** search
- const SERVICE_NAME="Yoono Observer";
- const SERVICE_CID = Components.ID("{29ecb220-c802-11dc-95ff-0800200c9a66}");
- const SERVICE_CTRID = "@yoono.com/yoono-connect;1";
-
- const CI = Components.interfaces;
- const CL = Components.classes;
-
- var Observer = {
- observe: function(aSubject, aTopic, aData) {
- if (aTopic!="app-startup") return;
-
- // Just notify main module of application startup
- Components.utils.import("resource://yoono/yoonoService.js");
- YOONO_CMPT.observe(aSubject, aTopic, aData);
-
- },
- QueryInterface : function (iid) {
- if(!iid.equals(CI.nsISupports) && !iid.equals(CI.nsIObserver))
- throw Components.results.NS_ERROR_NO_INTERFACE;
- return this;
- }
- };
-
- // routine de declaration du composant
- var Module = {
- registerSelf : function (compMgr, fileSpec, location, type) {
- // enregistrement
- compMgr.QueryInterface(CI.nsIComponentRegistrar).
- registerFactoryLocation(SERVICE_CID, SERVICE_NAME, SERVICE_CTRID, fileSpec, location, type);
- // definition des categories
- var catman = CL['@mozilla.org/categorymanager;1'].getService(CI.nsICategoryManager);
- catman.addCategoryEntry("app-startup", SERVICE_NAME, "service,"+SERVICE_CTRID, true, true);
- },
-
- unregisterSelf : function(compMgr, fileSpec, location) {
- // suppression categories
- var catman = CL['@mozilla.org/categorymanager;1'].getService(CI.nsICategoryManager);
- catman.deleteCategoryEntry("app-startup", SERVICE_NAME, true);
- // desenregistrement
- compMgr.QueryInterface(CI.nsIComponentRegistrar)
- .unregisterFactoryLocation(SERVICE_CID, fileSpec);
-
- },
-
- getClassObject : function (compMgr, cid, iid) {
- if(cid.equals(SERVICE_CID)) {
- return { // nsIFactory
- createInstance: function (outer, iid) {
- if (outer != null) throw Components.results.NS_ERROR_NO_AGGREGATION;
- return Observer;
- }
- };
- }
-
- if (!iid.equals(CI.nsIFactory))
- throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-
- throw Components.results.NS_ERROR_NO_INTERFACE;
- },
-
-
- canUnload : function(compMgr) {
- return true;
- }
-
- };
-
- function NSGetModule(compMgr, fileSpec) {
- return Module;
- }
-